package com.ming.seatMonitoring.service.ServiceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ming.seatMonitoring.mapper.NoticeMapper;
import com.ming.seatMonitoring.pojo.DO.NoticeDO;
import com.ming.seatMonitoring.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author 小明
 * @date 2021/10/24
 * @description
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, NoticeDO> implements NoticeService {
    @Autowired
    NoticeMapper noticeMapper;

    @Override
    public NoticeDO getNotice() {
        return noticeMapper.getNotice();
    }

    @Override
    public boolean add(String notice) {
        final NoticeDO noticeDO = new NoticeDO();
        noticeDO.setNotice(notice);
        noticeDO.setCreateTime(new Date());
        final int insert = noticeMapper.insert(noticeDO);
        return insert > 0;
    }
}
